}
}
+/**
+ * gdk_x11_window_set_hide_titlebar_when_maximized:
+ * @window: (type GdkX11Window): a #GdkWindow
+ * @hide_titlebar_when_maximized: whether to hide the titlebar when
+ * maximized
+ *
+ * Set a hint for the window manager, requesting that the titlebar
+ * should be hidden when the window is maximized.
+ *
+ * Note that this property is automatically updated by GTK+, so this
+ * function should only be used by applications which do not use GTK+
+ * to create toplevel windows.
+ *
+ * Since: 3.4
+ */
+void
+gdk_x11_window_set_hide_titlebar_when_maximized (GdkWindow *window,
+ gboolean hide_titlebar_when_maximized)
+{
+ GdkDisplay *display;
+
+ if (!WINDOW_IS_TOPLEVEL (window))
+ return;
+
+ display = gdk_window_get_display (window);
+
+ if (hide_titlebar_when_maximized)
+ {
+ guint32 hide = 1;
+ XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
+ GDK_WINDOW_XID (window),
+ gdk_x11_get_xatom_by_name_for_display (display, "_GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED"),
+ XA_CARDINAL, 32,
+ PropModeReplace, (guchar *)&hide, 1);
+ }
+ else
+ {
+ XDeleteProperty (GDK_DISPLAY_XDISPLAY (display),
+ GDK_WINDOW_XID (window),
+ gdk_x11_get_xatom_by_name_for_display (display, "_GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED"));
+ }
+}
+
#define GDK_SELECTION_MAX_SIZE(display) \
MIN(262144, \
XExtendedMaxRequestSize (GDK_DISPLAY_XDISPLAY (display)) == 0 \
guint has_focus : 1;
guint has_user_ref_count : 1;
guint has_toplevel_focus : 1;
+ guint hide_titlebar_when_maximized : 1;
guint iconify_initially : 1; /* gtk_window_iconify() called before realization */
guint is_active : 1;
guint maximize_initially : 1;
PROP_DEFAULT_WIDTH,
PROP_DEFAULT_HEIGHT,
PROP_DESTROY_WITH_PARENT,
+ PROP_HIDE_TITLEBAR_WHEN_MAXIMIZED,
PROP_ICON,
PROP_ICON_NAME,
PROP_SCREEN,
FALSE,
GTK_PARAM_READWRITE));
+ /**
+ * GtkWindow:hide-titlebar-when-maximized:
+ *
+ * Whether the titlebar should be hidden during maximization.
+ *
+ * Since: 3.4
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_HIDE_TITLEBAR_WHEN_MAXIMIZED,
+ g_param_spec_boolean ("hide-titlebar-when-maximized",
+ P_("Hide the titlebar during maximization"),
+ P_("If this window's titlebar should be hidden when the window is maximized"),
+ FALSE,
+ GTK_PARAM_READWRITE));
+
g_object_class_install_property (gobject_class,
PROP_ICON,
g_param_spec_object ("icon",
case PROP_DESTROY_WITH_PARENT:
gtk_window_set_destroy_with_parent (window, g_value_get_boolean (value));
break;
+ case PROP_HIDE_TITLEBAR_WHEN_MAXIMIZED:
+ gtk_window_set_hide_titlebar_when_maximized (window, g_value_get_boolean (value));
+ break;
case PROP_ICON:
gtk_window_set_icon (window,
g_value_get_object (value));
case PROP_DESTROY_WITH_PARENT:
g_value_set_boolean (value, priv->destroy_with_parent);
break;
+ case PROP_HIDE_TITLEBAR_WHEN_MAXIMIZED:
+ g_value_set_boolean (value, priv->hide_titlebar_when_maximized);
+ break;
case PROP_ICON:
g_value_set_object (value, gtk_window_get_icon (window));
break;
return window->priv->destroy_with_parent;
}
+/**
+ * gtk_window_set_hide_titlebar_when_maximized:
+ * @window: a #GtkWindow
+ * @setting: whether to hide the titlebar when @window is maximized
+ *
+ * If @setting is %TRUE, then @window will request that it's titlebar
+ * should be hidden when maximized.
+ * This is useful for windows that don't convey any information other
+ * than the application name in the titlebar, to put the available
+ * screen space to better use. If the underlying window system does not
+ * support the request, the setting will not have any effect.
+ *
+ * Since: 3.4
+ **/
+void
+gtk_window_set_hide_titlebar_when_maximized (GtkWindow *window,
+ gboolean setting)
+{
+ g_return_if_fail (GTK_IS_WINDOW (window));
+
+#ifdef GDK_WINDOWING_X11
+ {
+ GdkWindow *gdk_window;
+
+ gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
+
+ if (GDK_IS_X11_WINDOW (gdk_window))
+ gdk_x11_window_set_hide_titlebar_when_maximized (gdk_window, setting);
+ }
+#endif
+
+ window->priv->hide_titlebar_when_maximized = setting;
+ g_object_notify (G_OBJECT (window), "hide-titlebar-when-maximized");
+}
+
+/**
+ * gtk_window_get_hide_titlebar_when_maximized:
+ * @window: a #GtkWindow
+ *
+ * Returns whether the window has requested to have its titlebar hidden
+ * when maximized. See gtk_window_set_hide_titlebar_when_maximized ().
+ *
+ * Return value: %TRUE if the window has requested to have its titlebar
+ * hidden when maximized
+ *
+ * Since: 3.4
+ **/
+gboolean
+gtk_window_get_hide_titlebar_when_maximized (GtkWindow *window)
+{
+ g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
+
+ return window->priv->hide_titlebar_when_maximized;
+}
+
static GtkWindowGeometryInfo*
gtk_window_get_geometry_info (GtkWindow *window,
gboolean create)
gdk_window_set_keep_below (gdk_window, priv->below_initially);
if (priv->type == GTK_WINDOW_TOPLEVEL)
- gtk_window_set_theme_variant (window);
+ {
+ gtk_window_set_theme_variant (window);
+ gtk_window_set_hide_titlebar_when_maximized (window,
+ priv->hide_titlebar_when_maximized);
+ }
/* No longer use the default settings */
priv->need_default_size = FALSE;